{extend name="admin@public/base" /}
{block name="main-content"}
<div class="page-content">
	<link rel="stylesheet" type="text/css" media="all" href="__PUBLIC__/sldate/daterangepicker-bs3.css"/>
	<form name="" class="" method="post" id="list-filter" action="{:url('admin/Task/task_log')}">
		<div class="row maintop">
			{if $renwu==2 || $renwu==''}
			<div class="col-xs-3 col-sm-3 maintop">
				<select name="biaoz"  class="ajax_change">
					<option value="">子任务标志</option>
					{foreach zirwbzlist as $k=>$v}{if $v['fenlbm'] == '子任务标志'}
					<option value="{$v['daimid']}">{$v['daimmc']}</option>
					{/if}{/foreach}
				</select>

				<select name="cp" class="ajax_change">
					<option value="">选择产品</option>
					{foreach cp_list as $k=>$v}
					<option value="{$v['chanpid']}">{$v['chanpmc']}</option>
					{/foreach}
				</select>
				<select name="xm" class="ajax_change">
					<option value="">选择项目</option>
					{foreach xm_list as $k=>$v}
					<option value="{$v['xiangmid']}">{$v['xiangmmc']}</option>
					{/foreach}
				</select>
				<div class="col-xs-6 col-sm-3 jjwt" style="">
					<table class="table table-bordered">
						<tbody>
						<tr class="active">
							<th>解决任务个数</th>
							<th>{$sum}个</th>
						</tr>
						<tr class="active">
							<th>解决任务次数</th>
							<th>{$count}次</th>
						</tr>
						<tr class="active">
							<th>参与任务次数</th>
							<th>{$lz_count}次</th>
						</tr>
						<tr class="active">
							<th>总工时</th>
							<th>{$jiedgs}小时</th>
						</tr>
						</tbody>
					</table>
				</div>
			</div>
			{elseif $renwu==1 || $renwu==3}
			<!--隐藏发送renwu=1，否则查不到-->
			<input type="hidden" name="renwu" value="1">
			<div class="col-xs-12 col-sm-3 maintop">
				<select name="youxjb" class="ajax_change3">
					<option value="">优先级</option>
					<option value="">全部</option>
					{foreach ztlist as $k=>$v}{if $v['fenlbm'] == '优先级'}
					<option value="{$v['daimid']}">{$v['daimmc']}</option>
					{/if}{/foreach}
				</select>
				<select name="renwlx" class="ajax_change3">
					<option value="">任务类型</option>
					<option value="">全部</option>
					{foreach ztlist as $k=>$v}{if $v['fenlbm'] == '任务类型'}
					<option value="{$v['daimid']}">{$v['daimmc']}</option>
					{/if}{/foreach}
				</select>
				<select name="cp" class="ajax_change3">
					<option value="">选择产品</option>
					<option value="">全部</option>
					{foreach cp_list as $k=>$v}
					<option value="{$v['chanpid']}">{$v['chanpmc']}</option>
					{/foreach}
				</select>
				<select name="xm" class="ajax_change3">
					<option value="">选择项目</option>
					<option value="">全部</option>
					{foreach xm_list as $k=>$v}
					<option value="{$v['xiangmid']}">{$v['xiangmmc']}</option>
					{/foreach}
				</select>
				<div class="col-xs-6 col-sm-3 jjwt" style="">
					<table class="table table-bordered">
						<tbody>
						{if $renwu==1}
						<tr class="active">
							<th>总发布任务</th>
							<th>{$fb_count}个</th>
						</tr>
						{else}
						<!--隐藏发送renwu=1，否则查不到-->
						<input type="hidden" name="renwu" value="3">
						<tr class="active">
							<th>总关闭任务</th>
							<th>{$fb_count}个</th>
						</tr>
						{/if}
						</tbody>
					</table>
				</div>
			</div>
			{/if}
			<div class="col-xs-8 col-sm-3 hidden-xs btn-sespan">
				<div class="input-group">
										<span class="input-group-addon">
											<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
										</span>
					<input type="text" name="reservation" id="reservation" class="sl-date" value=""
						   placeholder="点击选择日期范围"/>
				</div>
			</div>
			<div class="col-xs-7 col-sm-4 btn-sespan chaxun">
				<div class="input-group">
									<span class="input-group-addon">
										<i class="ace-icon fa fa-check"></i>
									</span>
					<input type="text" name="key" id="key" class="form-control search-query admin_sea" value="" placeholder="输入需查询的任务标题、支持模糊查询"/>
					<span class="input-group-btn">
                        <button type="submit" class="btn btn-xs btm-input btn-purple ajax-search-form">
                            <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                            搜索
                        </button>
					</span>
				</div>
			</div>
			<div class="col-xs-2 col-sm-1 btn-sespan hidden-sm hidden-xs">
				<div class="input-group-btn">
					<a href="{:url('admin/Task/issue_add')}">
						<button type="button" class="btn btn-xs all-btn btn-danger">
							<i class="ace-icon fa fa-bolt bigger-110"></i>
							添加任务
						</button>
					</a>
				</div>
			</div>
		</div>
	</form>
	<div class="row  maintop">
		<div class="col-xs-12 col-sm-12">
			<a href="{:url('admin/Task/issue_add')}">
				<button type="button" class="btn btn-xs btn-danger">
					<i class="ace-icon fa fa-bolt bigger-110"></i>
					添加任务
				</button>
			</a>
			<a href="{:url('admin/Task/task_log',array('renwu'=>1))}">
				<button type="button" class="btn btn-xs btn-success">
					<i class="ace-icon fa fa-tasks bigger-110"></i>
					我发布的任务记录(包含关闭、未关闭)
				</button>
			</a>
			<a href="{:url('admin/Task/task_log',array('renwu'=>3))}">
				<button type="button" class="btn btn-xs btn-success">
					<i class="ace-icon fa fa-tasks bigger-110"></i>
					我关闭的任务
				</button>
			</a>
			<a href="{:url('admin/Task/task_log',array('renwu'=>2))}">
				<button type="button" class="btn btn-xs btn-success">
					<i class="ace-icon fa fa-history bigger-110"></i>
					我参与过的任务记录(默认)
				</button>
			</a>
		</div>
	</div>
	<div class="row" style="">
		<div class="col-xs-12">
			<div>
				<form id="alldel" name="alldel" method="post" action="{:url('admin/Task')}" >
					<div class="table-responsive">
						<table class="table table-striped table-bordered table-hover">
							<thead>
							{if $renwu==2 || $renwu==''}
							<tr>
								<th class="">序号</th>
								<th style="width: 30%;">任务标题</th>
								<th>状态标志</th>
								<th class="">子任务标志</th>
								<th class="">状态标志</th>
								<th class="">接收时间</th>
								<th class="">完成时间</th>
								<th class="">问题工时（小时）</th>
								<th style="border-right:#CCC solid 1px;width: 6%;">修改工时</th>
							</tr>
							{elseif $renwu==1 || $renwu==3}
							<tr>
								<th class="hidden-xs">编号</th>
								<th>任务标题</th>
								<th class="">优先级别</th>
								<th class="">当前状态</th>
								<th class="">状态标志</th>
								<th class="">当前阶段</th>
								<th class="">任务类型</th>
								<th class="">提出人员</th>
								<th class="">阶段负责人</th>
								<th class="">发布时间</th>
								<th class="">本阶段预计完成时间</th>
								<th class="">要求完成时间</th>
								<th class="">产品名称</th>
								<th class="">项目名称</th>
								<th class="">模块名称</th>
							</tr>
							{/if}
							</thead>

							<tbody id="ajax-data">
							{if $renwu==2 || $renwu==''}
							{include file="task/ajax_log_list"/}
							{elseif $renwu==1 || $renwu==3}
							{include file="task/ajax_log_fabu_list"/}
							{/if}
							</tbody>
						</table>
					</div>
				</form>
			</div>
		</div>
	</div>
	<!-- 显示模态框（Modal） -->
	<div class="modal fade in" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<form class="form-horizontal" name="" method="post" action="{:url('admin/Task/gs_runedit')}">
			<input type="hidden" name="zirwid" id="zirwid" />
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" id="gb"  data-dismiss="modal" aria-hidden="true">×
						</button>
						<h4 class="modal-title" id="myModalLabel">
							修改工时
						</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="col-sm-2 control-label no-padding-right"> 请输入工时： </label>
									<div class="col-sm-2">
										<input type="text" class="col-sm-8" id="hour" name="hour" value="0"/><span style="line-height: 30px;">小时</span>
									</div>
									<div class="col-sm-2">
										<input type="text" class="col-sm-8" id="fen" name="fen" value=""/><span style="line-height: 30px;">分</span>
									</div>
								</div>
							</div>
						</div>

					</div>
					<div class="modal-footer">
						<button type="submit" class="btn btn-primary" id="xiugai">
							修改
						</button>
						<button type="button" class="btn btn-default"  id="gbb" >
							关闭
						</button>
					</div>
					<!--小时和分只能输入数字，并且为正数-->
					<script>
                        $("#xiugai").click(function(){
                            var hour = $("#hour").val();
                            var fen = $("#fen").val();
                            var parnt = /(?!(^-?0(\d+)|^-?0(\.0+)?$))^-?\d+(?:\.\d+)?$/; //只能输入正负小数、整数
							if(hour == '' && fen != ''){
                                if(parnt.exec(fen) == null){
                                    alert('请输入数字');
                                    return false;
                                }
							}else if(hour != '' && fen == ''){
                                if(parnt.exec(hour) == null){
                                    alert('请输入数字');
                                    return false;
                                }
							}else if(hour != '' && fen !=''){
                                if(parnt.exec(fen) == null && fen != 0){
                                    alert('请输入数字');
                                    return false;
                                }
                                if(parnt.exec(hour) == null && hour !=0 ){
                                    alert('请输入数字');
                                    return false;
                                }
							}else{
                                return true;
							}

                        });
					</script>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</form>
	</div><!-- /.modal -->
</div><!-- /.page-content -->
{/block}
{block name="scripts"}
<script type="text/javascript" src="__PUBLIC__/sldate/moment.js"></script>
<script type="text/javascript" src="__PUBLIC__/sldate/daterangepicker.js"></script>
<script type="text/javascript">
    $('#reservation').daterangepicker(null, function (start, end, label) {
        console.log(start.toISOString(), end.toISOString(), label);
    });
</script>
{/block}